﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	会员修改密码页面
'	2011.11.2

Sub main
	checkLogin()'验证登录
	Dim a,userid,rs,sql,body_,sid_
	hu.title = "修改密码"
	body_ = "[div=nav]-"&hu.url("?aid=index","首页")&"-"& hu.url("bbs_user.asp","会员中心")&"-修改密码[/div]"
	a=getN("a", 0)
	userid=user_array(0)
	If a=0 Then
		Dim formarray(4)
		formarray(0) = http_path&"bbs_password.asp?a=1||post||提交||旧密码:<br/>"
		formarray(1) = "input||old$$$$20$$16||<br/>新密码:<br/>"
		formarray(2) = "input||new$$$$20$$16||<br/>重复新密码:<br/>"
		formarray(3) = "input||new2$$$$20$$16||<br/>"
		formarray(4) = "hidden||"&bbsSid&"$$"&sid&"||"
		body_ = body_ & hu.getForm(formarray)&""
	Else
		Dim oldpass,newpass,newpass2,passlen
		newpass=getD("new","")
		newpass2=getD("new2","")
		If newpass<>newpass2 Then rupt "错误", "新密码和重复密码必须相同!"
		passlen=len(newpass)
		If passlen>16 Or passlen<3 Then rupt "错误", "密码长度必须是3-16位!"
		oldpass=getD("old","")
		If newpass=oldpass Then rupt "错误", "新密码和旧密码不能相同!"
		sql = "select id from 74hu_user where password='"&oldpass&"' and id="&userid
		Set rs=hu.conn(sql)
		If Not rs.eof Then
			sid_=getOnlySid()
			hu.conn("update 74hu_user set [password]='"&newpass&"',sid='"&sid_&"' where id="&userid)
			body_ = body_ & "修改成功!请重新<a href="""&http_path&"bbs_login.asp"">登录</a>"
		Else
			body_ = body_ & "密码错误,请输入正确的密码!"
		End If
		rs.close
		Set rs=Nothing
	End If
	hu.body = comUbb(body_)
End Sub

%>